import { hasPermission } from '@/utils/getPermisssion';

const v_permission = {
  bind: (el, binding, vnode, oldVnode) => {
    const permission_str = binding.value

    const not = !hasPermission(permission_str)
    if (not) {
      el.style.display = 'none'
      el.innerHTML = ''
    }
  }
}

export const v_permission_directive = (vue) => {
  vue.directive('permission', v_permission)
}
